package phase1;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Vector;

public class IO {
	
	public static void main(String[] args){
		//get the text file of block data and import into a vector
		File file = new File("src/block.txt");
		BufferedReader reader = null;
		Vector<String[]> blockList = new Vector<String[]>();
		try{
			reader = new BufferedReader(new FileReader(file));
			String temp = null;
			while ((temp = reader.readLine()) != null){
				String[] blockValue = temp.split(",");
				blockList.add(blockValue);
			}
			reader.close();
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if (reader != null){
				try{
					reader.close();
				}catch(Exception e){
					e.printStackTrace();
				}
			}
		}
		//Use the data of Vector to create the blocks
		Vector<Block> blockVector = new Vector<Block>();
		for (int i = 0; i < blockList.size(); i++){
			Block b;
			String[] temp = blockList.get(i);
			if (temp.length == 3){
				b = new Block(temp[0], temp[1], temp[2]);
			}else{
				b = new Block();
				for (int index = 0 ; index < temp.length ; index++)
					b.addChar(temp[index]);
			}
			blockVector.add(b);
		}
		//Assign different walking path of the blocks structure
		
	}
	
	public void output(Vector<String> result){
		
	}
	
}
